package com.fenghongzhang.day012eventbus;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.drawerlayout.widget.DrawerLayout;

import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.View;

public class Main4Activity extends AppCompatActivity {
    private DrawerLayout draw;

    private static final String TAG = "Main4Activity";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main4);

        draw = (DrawerLayout) findViewById(R.id.draw);

        draw.addDrawerListener(new DrawerLayout.DrawerListener() {
            @Override
            public void onDrawerSlide(@NonNull View drawerView, float slideOffset) {
                Log.i(TAG, "onDrawerSlide: 开始滑动");
            }

            @Override
            public void onDrawerOpened(@NonNull View drawerView) {
                Log.i(TAG, "onDrawerOpened: 打开");
            }

            @Override
            public void onDrawerClosed(@NonNull View drawerView) {

                Log.i(TAG, "onDrawerClosed: 关闭");
            }

            @Override
            public void onDrawerStateChanged(int newState) {
                Log.i(TAG, "onDrawerStateChanged: "+newState);
            }
        });

    }

    public void open(View view) {
        draw.openDrawer(Gravity.LEFT);
//        draw.closeDrawer(Gravity.LEFT);
    }
}
